package com.banzhi.shop.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import com.banzhi.shop.R;
import com.banzhi.shop.base.BaseActivity;
import com.banzhi.shop.utils.Translucent;

/**
 * 店铺介绍
 */
public class ShopIntroduceActivity extends BaseActivity implements View.OnClickListener {
    /**
     * 传过来的店铺介绍内容
     */
    private String jieshao;
    /**
     * 退出
     */
    private ImageView ivback;
    /**
     * 店铺信息输入框
     */
    private EditText etcontext;
    private Button btnsave;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shop_introduce);
        Translucent.setTranslucent(this);
        Intent intent = getIntent();
        jieshao = intent.getStringExtra("data");
        setinits();
        setListeners();
        showViews();
    }

    private void showViews() {
        etcontext.setText(jieshao);
    }

    private void setinits() {
        ivback = (ImageView) findViewById(R.id.iv_back);
        etcontext = (EditText) findViewById(R.id.et_context);
        btnsave = (Button) findViewById(R.id.btn_save);
    }

    private void setListeners() {
        ivback.setOnClickListener(this);
        btnsave.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.btn_save:
                Intent intent = new Intent();
                intent.putExtra("data",etcontext.getText().toString().trim());
                setResult(200,intent);
                finish();
                break;
        }
    }
}
